package apps.AfterDlcs.city;

import apps.AfterDlcs.afterDlcsBL.city.City;
import apps.AfterDlcs.afterDlcsBL.city.CityBL;
import apps.AfterDlcs.afterDlcsBL.hero.HeroBL;
import backs.app.AppMenu;
import backs.bean.Message;

public class RecruitHeros extends AppMenu
{
    AfterDlcsCity afterDlcsCity;
    public RecruitHeros(AfterDlcsCity afterDlcsCity)
    {
        super("Recruit","Recruit",afterDlcsCity);
        this.afterDlcsCity=afterDlcsCity;
        this.showSon=false;
    }

    @Override
    public void handleEqual(Message message)
    {
        int lastPo=CityBL.getCityLastPopulation(message.getPrivateAsGroupID(),message.userID);
        if(lastPo<=0){
            message.sendBack("no more location for new hero");
            return;
        }
        int heroId= HeroBL.createNewHero(message.getPrivateAsGroupID(),15);
        HeroBL.recruitHeros(message.getPrivateAsGroupID(),message.userID,heroId);
        message.sendBack("u got a new hero named "+heroId+","+HeroBL.getHeroValue(message.getPrivateAsGroupID(),heroId,"age")+" years old,"
                +HeroBL.showSex(HeroBL.getHeroValue(message.getPrivateAsGroupID(),heroId,"sex"))+".give him(her) a new name at hero menu");
    }
}
